Fix USB timeout crashes during sensor initialization#245
Open
mpatton125 wants to merge 1 commit intouunicorn:masterfrom
Open
Fix USB timeout crashes during sensor initialization#245mpatton125 wants to merge 1 commit intouunicorn:masterfrom
mpatton125 wants to merge 1 commit intouunicorn:masterfrom
Conversation
Two issues cause python3-validity to crash on startup, particularly after reboot or when the sensor flash is uninitialized: 1. get_flash_info() in flash.py calls assert_status() on the response from command 0x3e, which throws on any 0x04xx status. These statuses indicate uninitialized flash, which is a normal condition that init_flash() is designed to handle. The crash prevents init_flash() from ever reaching its formatting logic. Fix: return an empty FlashInfo when status byte is 0x04, allowing init_flash() to proceed with flash formatting as intended. 2. send_init() in usb.py calls assert_status() on the init_hardcoded command, which fails with 0x0411 when no firmware is loaded. The very next lines check the 4302 (get_fw_info) response and fall through to init_hardcoded_clean_slate for exactly this case, but the assert prevents that path from ever being reached. Fix: remove assert_status() on init_hardcoded, allowing the existing clean slate fallback logic to work as designed. Tested on Lenovo ThinkPad X1 Carbon Gen 5 with Validity VFS495 (138a:0097) sensor running Ubuntu 25.10 / kernel 6.17.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two issues cause python3-validity to crash on startup, particularly after reboot or when the sensor flash is uninitialized:
get_flash_info() in flash.py calls assert_status() on the response from command 0x3e, which throws on any 0x04xx status. These statuses indicate uninitialized flash, which is a normal condition that init_flash() is designed to handle. The crash prevents init_flash() from ever reaching its formatting logic.
Fix: return an empty FlashInfo when status byte is 0x04, allowing init_flash() to proceed with flash formatting as intended.
send_init() in usb.py calls assert_status() on the init_hardcoded command, which fails with 0x0411 when no firmware is loaded. The very next lines check the 4302 (get_fw_info) response and fall through to init_hardcoded_clean_slate for exactly this case, but the assert prevents that path from ever being reached.
Fix: remove assert_status() on init_hardcoded, allowing the existing clean slate fallback logic to work as designed.
Tested on Lenovo ThinkPad X1 Carbon Gen 5 with Validity VFS495 (138a:0097) sensor running Ubuntu 25.10 / kernel 6.17.